

package com.juli.aimanager.datasource;

import java.lang.reflect.Method;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.reflect.MethodSignature;



public class DataSourceAspect  {
	

	public void pointcut(){
		
	};  
	
	public void before(JoinPoint point)  
    {  
		
		
        try {  
        	MethodSignature methodSignature = (MethodSignature) point.getSignature();
        	Method m = methodSignature.getMethod();
            
            if (m != null &&m.isAnnotationPresent(DataSource.class)) {  
            	DataSource data = m.getAnnotation(DataSource.class);  
                CustomerContextHolder.setDBType(data.name());  
            }  
              
        } catch (Exception e) {  
            e.printStackTrace();  
        }  
    }  
}
